//
//  SheetVC.swift
//  BWPanelKit
//
//  Created by zhuxuhong on 2022/2/25.
//

import UIKit
import BWExtensionKit

open class SheetVC: DrawerVC {
    open var contentHeight: CGFloat = 0
    
    open override var panelSize: CGSize {
        set{
            super.panelSize = newValue
        }
        get {
            let h = contentHeight > 0 ? contentHeight : panelView.bounds.height
            return .init(width: layoutSafeArea.size.width, height: h)
        }
    }
    
    public init(panelView: UIView, contentHeight: CGFloat) {
        super.init(
            panelView: panelView,
            panelSize: .zero,
            slideFrom: .bottom,
            slideStop: .bottomMiddle
        )
        self.contentHeight = contentHeight
    }
    
    public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
    }
    
    required public init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    open override func didInit() {
        super.didInit()
        slideFrom =  .bottom
        slideStop =  .bottomMiddle
    }
}
